#pragma once

#include <iostream>
#include <vector>
#include <cmath>
#include <random>
#include <thread>
#include <direct.h>
#include <regex>
#include <fstream>
#include <ctime>
#include <time.h>
#include <chrono>
#include <iomanip>
#include <corecrt_io.h>
#include <opencv2/opencv.hpp>

#define DEG 57.1

namespace WOOD
{
    std::string GetProgramDir();

    bool file_exists(const char* filename);

    std::string get_time();

    std::string get_date();

    void write_log(const char* state, const char* infor);

    std::string duration_to_string(const std::chrono::system_clock::duration& dur);

    bool isfolderfilenumtoobigger(const std::string& inpath, int maxnum);

    void removefile(const std::string& path);

    void fitLineRansac(const std::vector<cv::Point2f>& points, cv::Vec4f& line, int iterations = 100, double sigma = 1., double k_min = -270., double k_max = 270.);

    void AffinePoint(cv::Point2f& point, cv::Point2f& affinepoint, cv::Mat& hom);

    float rectanguler(const cv::Mat& mask);

    float distance_pp(cv::Point p1, cv::Point p2);

    void LetterBox(const cv::Mat& srcimg, cv::Mat& resizeimage, cv::Size size, int flag, int& newh, int& neww, int& top, int& left);
};